package com.sanploy.common.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sanploy.common.enums.RespType;

/**
 * Created by zhu yingzhi on 2017/9/13.
 * @author yingzhi zhu
 * 错误类型枚举 @JsonFormat 注解必须加入 不然无法解析
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum Meta {
    SUCCESS(200, "Response Success!",RespType.SUCCESSFUL),
    Fail(500, "Response fial!",RespType.FAIL),
    DeleteFail(500, "Delete fail!!",RespType.DeleteFail),
    InsertFail(500, "Insert Fail!",RespType.InsertFail),
    UpdateFail(500, "UpdateFail Fail!",RespType.UpdateFail),
    WechatFail(500, "Wechat RETURN Fail!",RespType.WechatFail),
    NullFail(500, "草泥马的NullPoint Exception!",RespType.NullFail),
    AuthFail(500, "身份 已过期 请重新登陆!",RespType.AuthFail),
    StockFail(500, "库存不足 我们正在添加库存 客官请稍后再来",RespType.StockFail),


    ServerError(500, "服务器开了一点小差 客官请从新访问!",RespType.Server_Error);



    private int code;
    private String message;
    private RespType type;

    Meta(int code, String message, RespType type){
        this.code = code;
        this.message = message;
        this.type = type;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public RespType getType() {
        return type;
    }

    @Override
    public String toString() {
        return "code="+code+" message="+message+" type="+type.toString();
    }
}

